package com.atguigu.bean;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @Author:zwy
 * @Despriction:
 * @Date:Create in 16:26 2018/7/7
 * @Modify By:
 */
@Component
public class Dog implements ApplicationContextAware {
    private ApplicationContext context;
    public Dog() {
        System.out.println("dog constructor----");
    }
    //对象创建并且赋值之后创建
    @PostConstruct
    public void init(){
        System.out.println("dog --PostConstruct---");
    }
    @PreDestroy
    public void destory(){
        System.out.println("dog --destory---");
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.context = applicationContext;
    }
}
